Copyright © Wei MEI, MLMS™—all rights reserved. 🀤
Collections¶
Collections are groups of items. Python supports several types of collections. Three of the most common are dictionaries, lists and arrays.
Lists¶
Lists are a collection of items. Lists can be expanded or contracted as needed, and can contain any data type. Lists are most commonly used to store a single column collection of information, however it is possible to nest lists
Arrays¶
Arrays are similar to lists, however are designed to store a uniform basic data type, such as integers or floating point numbers.
Dictionaries¶
Dictionaries are key/value pairs of a collection of items. Unlike a list where items can only be accessed by their index or value, dictionaries use keys to identify each item.
Demo: dates¶
PPT Demonstrations¶
Challenges time¶
Check the following script and try to find the mistake:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | # Challenge #1
# Create an Azure Custom Vision Service
# Analyze an image and return the JSON describing the image.
# call_api.py is a completed solution, but it will not run unless
# you do the following:
# Create a Custom Vision Service in Azure
# Update the Key
# Update the address of your service
# Update the image file and location
# Bonus Challenge
# Your skills are growing, it's time to start trying to figure things out on your own
# based on documentation. You have already called one function of the Computer Vision Service
# Now try calling another
# Instead of calling the analyze method of the service, try calling the OCR method
# Here is some helpful documentation
# https://docs.microsoft.com/azure/cognitive-services/Computer-vision/concept-recognizing-text#ocr-optical-character-recognition-api
# https://westus.dev.cognitive.microsoft.com/docs/services/5adf991815e1060e6355ad44/operations/56f91f2e778daf14a499e1fc
# Use the documentation to figure out
# The correct function name for the address
# The parameters you need to pass the function
# The HTTP Headers required
# Pass in an image containing text
# The JSON returned will contain the string of text in the image
# Good luck!
|
solutions: